#!/usr/bin/env coffee

import {join} from 'path'
import {DB} from '../const/dir'
import {mkdirSync} from 'fs'
import { open } from '@rmw/mdbx'

mkdirSync DB, recursive:true


export MDBX = open {
  path: join DB, 'rmw.mdb'
  maxDbs: 256
  commitDelay: 1000
  noMemInit: true
}

export default MDBX.transaction.bind MDBX

export Hash = MDBX.openDB 'hash', {
  dupSort:true
  keyIsBuffer: true
  encoding:'ordered-binary'
}

export Meta = MDBX.openDB 'meta',{
  keyIsBuffer: true
  encoding:'binary'
}

